<?php
function RenameFile($old, $new) {
  if(@rename("{$_SESSION['dir']}/$old", "{$_SESSION['dir']}/$new")) die("Success: [$old] has been renamed to [$new] successfully!");
  else die("Error: Cannot rename [$old]. Please try somewhere else!");
}

require_once('../../conf/main.conf.php');
if(isset($_REQUEST['oldname']) && !empty($_REQUEST['oldname']) && isset($_REQUEST['newname']) && !empty($_REQUEST['newname'])) {
  RenameFile($_REQUEST['oldname'], $_REQUEST['newname']);
}
else die("Unauthorized access");

?>
